<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>查询入账明细</title>
<script>
	var HttpPath = "http://paytest.shopping98.com/NetPayServer/PrePayEUserP_D?type=3";
	var time;
	var xmlhttpObj = getXmlHttp();

	function getXmlHttp() {
		var xmlhttp = false;
		// branch for native XMLHttpRequest object
		if (window.XMLHttpRequest) {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp = false;
			}
		}
		// branch for IE/Windows ActiveX version
		else if (window.ActiveXObject) {
			try {
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
					xmlhttp = false;
				}
			}
		}
		return xmlhttp;
	}

	function getNowFormatDate() {
		var date = new Date();

		var month = date.getMonth() + 1;
		var strDate = date.getDate();
		if (month >= 1 && month <= 9) {
			month = "0" + month;
		}

		if (strDate >= 0 && strDate <= 9) {
			strDate = "0" + strDate;
		}
		var hours = date.getHours();
		if (hours >= 0 && hours <= 9) {
			hours = "0" + hours;
		}
		var minutes = date.getMinutes();
		if (minutes >= 0 && minutes <= 9) {
			minutes = "0" + minutes;
		}
		var seconds = date.getSeconds();
		if (seconds >= 0 && seconds <= 9) {
			seconds = "0" + seconds;
		}
		var currentdate = date.getFullYear() + month + strDate + hours
				+ minutes + seconds;
		return currentdate;
	}

	function sendXmlRequest(jsonRequest) {
		var charset = document.getElementById("charset").value;
		if (xmlhttpObj) {
			var params = "jsonRequestData=" + jsonRequest + "&charset="
					+ charset;
			xmlhttpObj.open("POST", HttpPath, false);
			xmlhttpObj.setRequestHeader("Content-Type",
					"application/x-www-form-urlencoded");
			xmlhttpObj.send(params);

			var retXmlText = xmlhttpObj.responseText;

			return retXmlText;

		} else {
			alert("您的浏览器版本太低，请升级到IE5.0以上版本");
		}

	}

	function submit() {
		time = getNowFormatDate();
		var xmlRequest = "{";
		xmlRequest += "\"version\":\"" + version.value + "\",";
		xmlRequest += "\"charset\":\"" + charset.value + "\",";
		xmlRequest += "\"signType\":\"" + signType.value + "\",";
		xmlRequest += "\"reqData\":";
		xmlRequest += "{";
		xmlRequest += "\"dateTime\":\"" + time + "\",";
		xmlRequest += "\"branchNo\":\"" + branchNo.value + "\",";
		xmlRequest += "\"merchantNo\":\"" + merchantNo.value + "\",";
		xmlRequest += "\"date\":\"" + date.value + "\",";
		xmlRequest += "\"operatorNo\":\"" + operatorNo.value + "\",";
		xmlRequest += "\"nextKeyValue\":\"" + nextKeyValue.value + "\"";
		xmlRequest += "}}";

		var rsp = JSON.parse(sendXmlRequest(xmlRequest));
		document.getElementById("rspversion").value = rsp.version;
		document.getElementById("rspcharset").value = rsp.charset;
		document.getElementById("rspCode").value = rsp.rspData.rspCode;
		document.getElementById("rspMesg").value = rsp.rspData.rspMesg;
		document.getElementById("dateTime").value = rsp.rspData.dateTime;
		document.getElementById("rspData").value = JSON.stringify(rsp.rspData);

	}
</script>
</head>
<body>
	<table>
		<tr>
			<td>
				<label for="version"> version: </label>
				<input name="version" type="text" id="version" value="1.0">
				<br />
				<label for="charset"> charset:</label>
				<input name="charset" type="text" id="charset" value="UTF-8">
				<br />

				<label for="signType"> signType:</label>
				<input name="signType" type="text" id="signType" value="SHA-256">
				<br />
				<label for="reqData"> reqData:</label>
				<input type="text" name="reqData" id="reqData">
				<br><br />
				<label for="branchNo"> branchNo:</label>
				<input name="branchNo" type="text" id="branchNo" value="0755">
				<br />
				<label for="merchantNo"> merchantNo:</label>
				<input name="merchantNo" type="text" id="merchantNo" value="000054">
				<br /> date:
				<input name="date" type="text" id="date" value="20160624">
				<br />
				<label for="operatorNo">operatorNo:</label>
				<input name="operatorNo" type="text" id="operatorNo" value="9999">
				<label for="nextKeyValue">
					<br> nextKeyValue:
				</label>
				<input name="nextKeyValue" type="text" id="nextKeyValue" value="">
				<p>
					<input type="button" name="submit" id="submit" value="提交" onClick="submit();">
				</p>
			</td>
			<td width="100"></td>
			<td valign="top">
				<label for="version"> version:</label>
				<input name="rspversion" type="text" id="rspversion" value="">
				<br />
				<label for="charset"> charset:</label>
				<input name="rspcharset" type="text" id="rspcharset" value="" />
				<br />
				<label for="rspCode"> rspCode:</label>
				<input name="rspCode" type="text" id="rspCode" value="" />
				<br />
				<label for="rspMesg"> rspMesg:</label>
				<input name="rspMesg" type="text" id="rspMesg" value="" />
				<br />
				<label for="dateTime"> dateTime:</label>
				<input name="dateTime" type="text" id="dateTime" value="" />
				<br />
				<label for="rspData"> rspData:</label>
				<textarea rows="10" id="rspData" style="width: 400px"></textarea>
				<br />
			</td>
		</tr>
	</table>
</body>
</html>
